/*define([], function() {
	return {
		/*
		 * var div = document.getElementsByClassName("ban")[0];
		var ul = document.getElementsByClassName("banul")[0];
		var ol = document.getElementsByClassName("banol")[0];
		var bg = document.getElementById("banner");
		var imgs = ul.children; //图片
		var li = ol.children; // 按钮
		var now = 0;
		var arr = ["#202056", "#fef2f2", "#aab6c4", "#fff", "#4dd0e4", "#51d9e7"]
		tab();

		for (var i = 0; i < li.length; i++) {
			li[i].index = i;
			li[i].onmouseover = function() {
				now = this.index;
				tab();
			}
		}
		
		tab: (function(now,imgs,li,bg,startM,arr) {
			for (var i = 0; i < 6; i++) {
				imgs[i].style.zIndex = 0;
				li[i].className = "";
				startM.startMove(imgs[i], {
					"opacity": 0
				});
			}
			li[now].className = "selectedd";
			imgs[now].style.zIndex = 1;
			bg.style.backgroundColor = arr[now];
			startM.startMove(imgs[now], {
				"opacity": 100
			});
		}),

		next: function(now,imgs,li,bg,startM,arr,ban){
			
			now++;
			if (now == 6) {
				now = 0;
			}
			
			tab.apply(this,arguments);
		},

		timer: function(){
			setInterval(this.next, 5000);
		}

		div.onmouseover = function() {
			clearInterval(timer);
		}

		div.onmouseout = function() {
			timer = setInterval(next, 5000);
		}
	}
});*/
(function(){
	var div = document.getElementsByClassName("ban")[0];
		var ul = document.getElementsByClassName("banul")[0];
		var ol = document.getElementsByClassName("banol")[0];
		var bg = document.getElementById("banner");
		var imgs = ul.children; //图片
		var li = ol.children; // 按钮
		var now = 0;
		var arr = ["#202056", "#fef2f2", "#aab6c4", "#fff", "#4dd0e4", "#51d9e7"]
		tab();

for(var i=0; i<li.length; i++){
	li[i].index = i;
	li[i].onmouseover = function(){
		now = this.index;
		tab();		
	}
}

function tab(){
	for(var i=0; i<6; i++){
		imgs[i].style.zIndex = 0;
		li[i].className = "";
		startMove(imgs[i], {"opacity": 0 });
	}
	li[now].className = "selectedd";
	bg.style.backgroundColor = arr[now];
	imgs[now].style.zIndex = 1;
	startMove(imgs[now], {"opacity": 100 });
}

function next(){
	now++;
	if( now == 6 ){
		now = 0;	
	}
	tab();
}

var timer = setInterval(next, 5000);

div.onmouseover = function(){
	clearInterval(timer);
}

div.onmouseout = function(){
	timer = setInterval(next, 5000);
}

})();
